document.addEventListener("DOMContentLoaded", function() { const alertUsers = document.querySelectorAll('.alert-user'); let currentIndex = 0; function showNextAlert() { if (currentIndex < alertUsers.length) { alertUsers[currentIndex].classList.add('active'); setTimeout(hideCurrentAlert, 4000); // Show for 2 seconds setTimeout(() => { currentIndex++; showNextAlert(); // Move to the next alert after 2 seconds }, 10500); // Wait for 7.5 seconds before moving to the next alert } } function hideCurrentAlert() { alertUsers[currentIndex].classList.remove('active'); } setTimeout(showNextAlert, 4000); // Start showing alerts after 8 seconds });